import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WorkCarVO, WorkCarForm, WorkCarQuery } from '@/api/dashboard/workCar/types';

/**
 * 查询看板火车位置实时展示列表
 * @param query
 * @returns {*}
 */

export const listWorkCar = (query?: WorkCarQuery): AxiosPromise<WorkCarVO[]> => {
  return request({
    url: '/dashboard/workCar/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询看板火车位置实时展示详细
 * @param id
 */
export const getWorkCar = (id: string | number): AxiosPromise<WorkCarVO> => {
  return request({
    url: '/dashboard/workCar/' + id,
    method: 'get'
  });
};

/**
 * 新增看板火车位置实时展示
 * @param data
 */
export const addWorkCar = (data: WorkCarForm) => {
  return request({
    url: '/dashboard/workCar',
    method: 'post',
    data: data
  });
};

/**
 * 修改看板火车位置实时展示
 * @param data
 */
export const updateWorkCar = (data: WorkCarForm) => {
  return request({
    url: '/dashboard/workCar',
    method: 'put',
    data: data
  });
};

/**
 * 删除看板火车位置实时展示
 * @param id
 */
export const delWorkCar = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dashboard/workCar/' + id,
    method: 'delete'
  });
};
/**
 * 获取看板火车位置实时展示
 * @param query
 */
export const getWorkAllCar = () => {
  return request({
    url: '/dashboard/workCar/allList',
    method: 'get'
  });
};
/**
 * 获取看板台位列表
 * @param query
 */
export const getTablesCar = () => {
  return request({
    url: '/dashboard/workCar/workstationSelect',
    method: 'get'
  });
};
